package com.detect.main;

import java.util.List;

import com.detect.model.FileInfo;
import com.detect.service.IScanService;
import com.detect.service.ScanService;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		long startTime = System.currentTimeMillis(); // 获取开始时间
		IScanService sService = new ScanService("D:\\myMusic", false,
				100 * 1024, 15 * 1024 * 1024);
		sService.doScan();
		long endTime = System.currentTimeMillis(); // 获取结束时间
		System.out.println("总用时: " + (endTime - startTime) + " ms");
		System.out.println("共扫描: " + sService.getFileCount() + " 个文件");

		long totalSize = 0;
		List<FileInfo> files = sService.getFileInfos();
		for (FileInfo file : files) {
			totalSize += file.getFileSize();
		}

		System.out
				.println("总大小: "
						+ (totalSize > 1024 * 1024 * 1024 ? totalSize / 1024.0 / 1024.0 / 1024.0 : totalSize / 1024.0 / 1024.0)
						+ (totalSize > 1024 * 1024 * 1024 ? " GB" : " MB"));

	}
}
